add SEND_EMAIL_IN_DEVELOPMENT option to .env.example

Andrew Cantino лет %!s(int64=9): %!d(string=назад)
Родитель
Сommit
1f8ecc29d1
4 измененных файлов с 12 добавлено и 6 удалено
  1. 5 2
      .env.example
  2. 1 1
      README.md
  3. 1 1
      config/environments/development.rb
  4. 5 2
      deployment/site-cookbooks/huginn_production/files/default/env.example

+ 5 - 2
.env.example

@@ -55,8 +55,8 @@ INVITATION_CODE=try-huginn
55 55
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
56 56
 #
57 57
 # PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
58
-# you must also change config.action_mailer.perform_deliveries in config/environments/development.rb.
59
-# 
58
+# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below.
59
+#
60 60
 # If you have trouble with port 587 on Gmail, you can also try setting
61 61
 # SMTP_AUTHENTICATION to login and the SMTP_PORT to 465.
62 62
 
@@ -68,6 +68,9 @@ SMTP_PORT=587
68 68
 SMTP_AUTHENTICATION=plain
69 69
 SMTP_ENABLE_STARTTLS_AUTO=true
70 70
 
71
+# Send emails when running in the development Rails environment.
72
+SEND_EMAIL_IN_DEVELOPMENT=false
73
+
71 74
 # The address from which system emails will appear to be sent.
72 75
 EMAIL_FROM_ADDRESS=from_address@gmail.com
73 76
 

+ 1 - 1
README.md

@@ -64,7 +64,7 @@ If you just want to play around, you can simply fork this repository, then perfo
64 64
 * Read the [wiki][wiki] for usage examples and to get started making new Agents.
65 65
 * Periodically run `git fetch upstream` and then `git checkout master && git merge upstream/master` to merge in the newest version of Huginn.
66 66
 
67
-Note: by default, emails are not sent in the `development` Rails environment, which is what you just setup.  If you'd like to enable emails when playing with Huginn locally, edit `config.action_mailer.perform_deliveries` in `config/environments/development.rb`.
67
+Note: by default, emails are not sent in the `development` Rails environment, which is what you just setup.  If you'd like to enable emails when playing with Huginn locally, set `SEND_EMAIL_IN_DEVELOPMENT` to `true` in your `.env` file.
68 68
 
69 69
 If you need more detailed instructions, see the [Novice setup guide][novice-setup-guide].
70 70
 

+ 1 - 1
config/environments/development.rb

@@ -39,7 +39,7 @@ Huginn::Application.configure do
39 39
 
40 40
   config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] }
41 41
   config.action_mailer.asset_host = ENV['DOMAIN']
42
-  config.action_mailer.perform_deliveries = false # Enable when testing!
42
+  config.action_mailer.perform_deliveries = ENV['SEND_EMAIL_IN_DEVELOPMENT'] == 'true'
43 43
   config.action_mailer.raise_delivery_errors = true
44 44
   config.action_mailer.delivery_method = :smtp
45 45
   # smtp_settings moved to config/initializers/action_mailer.rb

+ 5 - 2
deployment/site-cookbooks/huginn_production/files/default/env.example

@@ -46,8 +46,8 @@ INVITATION_CODE=try-huginn
46 46
 # Outgoing email settings.  To use Gmail or Google Apps, put your Google Apps domain or gmail.com
47 47
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
48 48
 # 
49
-# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment), 
50
-# you must also change config.action_mailer.perform_deliveries in config/environments/development.rb.
49
+# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
50
+# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below.
51 51
 
52 52
 SMTP_DOMAIN=your-domain-here.com
53 53
 SMTP_USER_NAME=you@gmail.com
@@ -57,6 +57,9 @@ SMTP_PORT=587
57 57
 SMTP_AUTHENTICATION=plain
58 58
 SMTP_ENABLE_STARTTLS_AUTO=true
59 59
 
60
+# Send emails when running in the development Rails environment.
61
+SEND_EMAIL_IN_DEVELOPMENT=false
62
+
60 63
 # The address from which system emails will appear to be sent.
61 64
 EMAIL_FROM_ADDRESS=from_address@gmail.com
62 65